library(dplyr)
library(readr)
library(tidyr)
library(lme4)
library(mediation)
library(haven)
library(modelsummary)
library(ggplot2)
library(marginaleffects)
climate_analysis = read_dta("C:/Users/lerner-josh/Dropbox/America1Room/Climate/data/Full_With_FollowUp/climate_data_foranalyses_27items.dta ")
climate_analysis$delegate

#worry as mediator

worry_reg12 = lmer(worry_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                   (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
worry_reg13 = lmer(worry_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                   (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +worry_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                        (1|state_id), data =climate_analysis)
med_imp_clim_worry12 = mediate(worry_reg12, import_climate12, treat = "delegate", mediator = "worry_diff1_2",
                            robustSE = T, sims = 1000)
summary(med_imp_clim_worry12)


import_climate13 = lmer(importance_climate3~delegate +worry_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_imp_clim_worry13 = mediate(worry_reg13, import_climate13, treat = "delegate", mediator = "worry_diff1_3",
                               robustSE = T, sims = 1000)
summary(med_imp_clim_worry13)

# Vote Pref DV


worry_reg12_vote = lmer(worry_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])
worry_reg13_vote = lmer(worry_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +worry_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_vote_pref_worry12 = mediate(worry_reg12_vote, vote_pref12, treat = "delegate", mediator = "worry_diff1_2",
                               robustSE = T, sims = 1000)
summary(med_vote_pref_worry12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate +worry_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis)
med_vote_pref_worry13 = mediate(worry_reg13_vote, vote_pref13, treat = "delegate", mediator = "worry_diff1_3",
                                robustSE = T, sims = 1000)
summary(med_vote_pref_worry13)



############################



#worry as mediator

belief_reg12 = lmer(belief_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
belief_reg13 = lmer(belief_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +belief_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_imp_clim_belief12 = mediate(belief_reg12, import_climate12, treat = "delegate", mediator = "belief_diff1_2",
                               robustSE = T, sims = 1000)
summary(med_imp_clim_belief12)


import_climate13 = lmer(importance_climate3~delegate +belief_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_imp_clim_belief13 = mediate(belief_reg13, import_climate13, treat = "delegate", mediator = "belief_diff1_3",
                               robustSE = T, sims = 1000)
summary(med_imp_clim_belief13)

# Vote Pref DV


belief_reg12_vote = lmer(belief_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])
belief_reg13_vote = lmer(belief_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +belief_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis)
med_vote_pref_belief12 = mediate(belief_reg12_vote, vote_pref12, treat = "delegate", mediator = "belief_diff1_2",
                                robustSE = T, sims = 1000)
summary(med_vote_pref_belief12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate +belief_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis)
med_vote_pref_belief13 = mediate(belief_reg13_vote, vote_pref13, treat = "delegate", mediator = "belief_diff1_3",
                                robustSE = T, sims = 1000)
summary(med_vote_pref_belief13)





############################

climate_analysis$knowledge_diff1_2 = climate_analysis$climate_knowledge2 - climate_analysis$climate_knowledge1
climate_analysis$knowledge_diff1_3 = climate_analysis$climate_knowledge3 - climate_analysis$climate_knowledge1

#climate knowledge as mediator

knowledge_reg12 = lmer(knowledge_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                      (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
knowledge_reg13 = lmer(knowledge_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                      (1|state_id), data =climate_analysis[is.na(climate_analysis$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +knowledge_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_imp_clim_knowledge12 = mediate(knowledge_reg12, import_climate12, treat = "delegate", mediator = "knowledge_diff1_2",
                                robustSE = T, sims = 1000)
summary(med_imp_clim_knowledge12)


import_climate13 = lmer(importance_climate3~delegate +knowledge_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis)
med_imp_clim_knowledge13 = mediate(knowledge_reg13, import_climate13, treat = "delegate", mediator = "knowledge_diff1_3",
                                robustSE = T, sims = 1000)
summary(med_imp_clim_knowledge13)

# Vote Pref DV


knowledge_reg12_vote = lmer(knowledge_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                           (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])
knowledge_reg13_vote = lmer(knowledge_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                           (1|state_id), data =climate_analysis[is.na(climate_analysis$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +knowledge_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis)
med_vote_pref_knowledge12 = mediate(knowledge_reg12_vote, vote_pref12, treat = "delegate", mediator = "knowledge_diff1_2",
                                 robustSE = T, sims = 1000)
summary(med_vote_pref_knowledge12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate + knowledge_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis)
med_vote_pref_knowledge13 = mediate(knowledge_reg13_vote, vote_pref13, treat = "delegate", mediator = "knowledge_diff1_3",
                                 robustSE = T, sims = 1000)
summary(med_vote_pref_knowledge13)

















#######################################################################


# Middle Group only 


#######################################################################


climate_analysis$middle = 0
climate_analysis$middle[climate_analysis$ideology_score1 >= 3 & 
                          climate_analysis$ideology_score1 <= 5] = 1
table(climate_analysis$middle)

#worry as mediator

climate_analysis_mid = climate_analysis[climate_analysis$middle == 1,]


worry_reg12 = lmer(worry_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
worry_reg13 = lmer(worry_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +worry_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_worry12 = mediate(worry_reg12, import_climate12, treat = "delegate", mediator = "worry_diff1_2",
                               robustSE = T, sims = 1000)
summary(mid_med_imp_clim_worry12)


import_climate13 = lmer(importance_climate3~delegate +worry_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_worry13 = mediate(worry_reg13, import_climate13, treat = "delegate", mediator = "worry_diff1_3",
                               robustSE = T, sims = 1000)
summary(mid_med_imp_clim_worry13)

# Vote Pref DV


worry_reg12_vote = lmer(worry_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])
worry_reg13_vote = lmer(worry_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +worry_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_worry12 = mediate(worry_reg12_vote, vote_pref12, treat = "delegate", mediator = "worry_diff1_2",
                                robustSE = T, sims = 1000)
summary(mid_med_vote_pref_worry12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate +worry_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_worry13 = mediate(worry_reg13_vote, vote_pref13, treat = "delegate", mediator = "worry_diff1_3",
                                robustSE = T, sims = 1000)
summary(mid_med_vote_pref_worry13)



############################


#worry as mediator

belief_reg12 = lmer(belief_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                      (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
belief_reg13 = lmer(belief_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                      (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +belief_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_belief12 = mediate(belief_reg12, import_climate12, treat = "delegate", mediator = "belief_diff1_2",
                                robustSE = T, sims = 1000)
summary(mid_med_imp_clim_belief12)


import_climate13 = lmer(importance_climate3~delegate +belief_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_belief13 = mediate(belief_reg13, import_climate13, treat = "delegate", mediator = "belief_diff1_3",
                                robustSE = T, sims = 1000)
summary(mid_med_imp_clim_belief13)

# Vote Pref DV


belief_reg12_vote = lmer(belief_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                           (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])
belief_reg13_vote = lmer(belief_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                           (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +belief_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_belief12 = mediate(belief_reg12_vote, vote_pref12, treat = "delegate", mediator = "belief_diff1_2",
                                 robustSE = T, sims = 1000)
summary(mid_med_vote_pref_belief12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate +belief_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_belief13 = mediate(belief_reg13_vote, vote_pref13, treat = "delegate", mediator = "belief_diff1_3",
                                 robustSE = T, sims = 1000)
summary(mid_med_vote_pref_belief13)


############################

#climate knowledge as mediator

knowledge_reg12 = lmer(knowledge_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                         (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
knowledge_reg13 = lmer(knowledge_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                         (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$importance_climate3) == F,])
#Climate Import DV

import_climate12 = lmer(importance_climate3~delegate +knowledge_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_knowledge12 = mediate(knowledge_reg12, import_climate12, treat = "delegate", mediator = "knowledge_diff1_2",
                                   robustSE = T, sims = 1000)
summary(mid_med_imp_clim_knowledge12)


import_climate13 = lmer(importance_climate3~delegate +knowledge_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                          (1|state_id), data =climate_analysis_mid)
mid_med_imp_clim_knowledge13 = mediate(knowledge_reg13, import_climate13, treat = "delegate", mediator = "knowledge_diff1_3",
                                   robustSE = T, sims = 1000)
summary(mid_med_imp_clim_knowledge13)

# Vote Pref DV


knowledge_reg12_vote = lmer(knowledge_diff1_2~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                              (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])
knowledge_reg13_vote = lmer(knowledge_diff1_3~delegate +  ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                              (1|state_id), data =climate_analysis_mid[is.na(climate_analysis_mid$congress_pref_dem3) == F,])


vote_pref12 = lmer(congress_pref_dem3 ~delegate +knowledge_diff1_2 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_knowledge12 = mediate(knowledge_reg12_vote, vote_pref12, treat = "delegate", mediator = "knowledge_diff1_2",
                                    robustSE = T, sims = 1000)
summary(mid_med_vote_pref_knowledge12)

vote_pref13 = lmer(congress_pref_dem3 ~delegate +knowledge_diff1_3 +   ideology_score1 + college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner + 
                     (1|state_id), data =climate_analysis_mid)
mid_med_vote_pref_knowledge13 = mediate(knowledge_reg13_vote, vote_pref13, treat = "delegate", mediator = "knowledge_diff1_3",
                                    robustSE = T, sims = 1000)
summary(mid_med_vote_pref_knowledge13)

###########################


rep_cong_ideo1 =glmer(congress_pref_dem3 ~ delegate*ideology_score1 +as.factor(party)+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                   data = climate_analysis, family = 'binomial')

rep_cong_ideo2 =glmer(congress_pref_dem3 ~ delegate*ideology_score2 +as.factor(party)+ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                   data =climate_analysis, family = 'binomial')
rep_cong_ideo3 =glmer(congress_pref_dem3 ~ delegate*ideology_score3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                   data = climate_analysis, family = 'binomial')

summary(rep_cong_ideo1)
summary(rep_cong_ideo2)
summary(rep_cong_ideo3)

models = list(rep_cong_ideo1, rep_cong_ideo2, rep_cong_ideo3)

modelsummary(models, 
             coef_omit = "coll|male|over|lowin|party|tercept", 
             gof_omit = "RMSE|ICC|Marg.", 
             output = "rep_cong_vote.html", stars = T
)


rep_cong_imp3 =glmer(congress_pref_dem3 ~ delegate*importance_climate3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                      data = climate_analysis, family = 'binomial')
summary(rep_cong_imp3)
rep_cong_imp_crime3 =glmer(congress_pref_dem3 ~ delegate*importance_crime3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                     data = climate_analysis, family = 'binomial')
summary(rep_cong_imp_crime3)

rep_cong_imp_demo3 =glmer(congress_pref_dem3 ~ delegate*importance_democracy3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                           data = climate_analysis, family = 'binomial')
summary(rep_cong_imp_demo3)

modelsummary(list(rep_cong_imp3, rep_cong_imp_crime3, rep_cong_imp_demo3), 
             coef_omit = "coll|male|over|lowin|party|tercept|ideo|white|marri|home|employ|rural", 
             gof_omit = "RMSE|ICC|Marg.", 
             output = "rep_cong_vote2.html", stars = T
)

ggplot(climate_analysis, aes(x = importance_climate3, fill = as.factor(delegate))) + geom_density(alpha = 0.6) +
  xlab("Importance of Climate 10 pt Scale") + labs(fill = "Participant") +theme_bw()
ggplot(climate_analysis, aes(x = importance_democracy3, fill = as.factor(delegate))) + geom_density(alpha = 0.6) +
  xlab("Importance of Democracy 10 pt Scale") + labs(fill = "Participant")+theme_bw()
ggplot(climate_analysis, aes(x = importance_crime3, fill = as.factor(delegate))) + geom_density(alpha = 0.6) +
  xlab("Importance of Crime 10 pt Scale") + labs(fill = "Participant")+theme_bw()

library(marginaleffects)
plot_predictions(rep_cong_imp3, c("importance_climate3", "delegate"), conf_level = 0.85) + 
                 xlab("Importance of Climate 10 pt Scale") +ylab("Probability Support Dem Congress") + ggtitle("Predicted Support of Democratic Congress By Participation and Climate Importance")

plot_predictions(rep_cong_imp_crime3, c("importance_crime3", "delegate"), conf_level = 0.95) + 
  xlab("Importance of Crime 10 pt Scale") +ylab("Probability Support Dem Congress") + ggtitle("Predicted Support of Democratic Congress By Participation and Crime Importance")

#rep_cong_know3 =glmer(congress_pref_dem3 ~ delegate*climate_knowledge3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
#                     data = climate_analysis, family = 'binomial')
#summary(rep_cong_know3)


rep_cong_imp3_alt =glmer(congress_pref_dem3 ~ delegate*importance_climate3 +delegate2019+as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                     data = climate_analysis, family = 'binomial')
summary(rep_cong_imp3_alt)


# ols robustness check

rep_cong_imp3_a =lmer(congress_pref_dem3 ~ delegate*importance_climate3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                     data = climate_analysis)
summary(rep_cong_imp3)
rep_cong_imp_crime3 =glmer(congress_pref_dem3 ~ delegate*importance_crime3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                           data = climate_analysis, family = 'binomial')
summary(rep_cong_imp_crime3)

rep_cong_imp_demo3 =glmer(congress_pref_dem3 ~ delegate*importance_democracy3 +as.factor(party) +ideology_score1+ college_grad + male + over60 + white + married + employed + lowinc + rural + home_owner+ (1|state_id), 
                          data = climate_analysis, family = 'binomial')
summary(rep_cong_imp_demo3)

modelsummary(list(rep_cong_imp3, rep_cong_imp_crime3, rep_cong_imp_demo3), 
             coef_omit = "coll|male|over|lowin|party|tercept|ideo|white|marri|home|employ|rural", 
             gof_omit = "RMSE|ICC|Marg.", 
             output = "rep_cong_vote2.html", stars = T
)







